package pl.org.lutra.planner.gui.table;

import pl.org.lutra.planner.gui.table.RuntimeTableModel.RuntimeColumn;
import pl.org.lutra.planner.gui.util.DepthFormat;
import pl.org.lutra.planner.gui.util.TimeFormat;
import pl.org.lutra.planner.model.data.RuntimeSegment;

public class RuntimeTable extends PlannerTable<RuntimeSegment> {
    private static final long serialVersionUID = -6044825937083261323L;
    
    public RuntimeTable() {
        super(new RuntimeTableModel());
        
        setRowSelectionAllowed(false);
        
        initColumnsBehavior();
    }
    
    private void initColumnsBehavior() {
        PaddingTableCellRenderer depthRenderer = new PaddingTableCellRenderer(new DepthFormat());
        setColumnBehavior(RuntimeColumn.DEPTH, depthRenderer, null);
        
        PaddingTableCellRenderer timeRenderer = new PaddingTableCellRenderer(new TimeFormat());
        setColumnBehavior(RuntimeColumn.RUNTIME, timeRenderer, null);
    }
    
    @Override
    public RuntimeTableModel getModel() {
        return (RuntimeTableModel) super.getModel();
    }
}
